<template>
	<view class="mymap">
		<view class="page-section page-section-gap">
			<map style="position: absolute; left: 0; top: 0; width: 100%; height: 100%;" :latitude="latitude"
				:longitude="longitude" :markers="covers" show-location="true" @markertap="navGet">
			</map>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'map',
				latitude: 25.49513,
				longitude: 103.80481,
				covers: [{
					id: 0,
					userid:'',
					latitude: 25.49513,
					width: 40,
					height: 40,
					longitude: 103.80481,
					iconPath: 'https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTK96fSibNjgmuRMlCPvsnhWiaRxsVVfDcFMe7NXVAfMr9Cd0CGHZV0x0Dv2kYB5l6LwBE0uetG3KyPA/132'
				},
				
				{
					id: 1,
					latitude: 25.495,
					width: 40,
					height: 40,
					longitude: 103.804,
					iconPath: 'https://thirdwx.qlogo.cn/mmopen/vi_32/oibqGrCYmOibCU1DpicD1gQCd9RvKD1SlibKVPRELlHkEqDicWN7CAJQdB9tmzS95U9hLVL78mRFk1MawaHp9uWiaib3g/132'
				},
				
				 
				 
				 ]

			}
		},

		onShow() {
			// this.getLocation()
		},

		onReady() {
			this.getLocation()
		},

		methods: {
			getLocation() {
				var that = this
				wx.getLocation({
					type: 'gcj02',
					success: function(res) {
						that.latitude = parseFloat(res.latitude)
						that.longitude = parseFloat(res.longitude) 
						
						console.log('当前位置的经度：' + res.longitude);
						console.log('当前位置的纬度：' + res.latitude);
					}
				});
			},
			navGet(e){
				
				uni.navigateTo({
					url:'../detail/detail?userid='+getApp().globalData.user._id
				})
				console.log(e)
			}
		}
	}
</script>

<style>

</style>
